


***** RECODING *****


*** Sociodemographics
rename Respondent_Serial respondent

gen country=.
replace country=1 if CountryCode1==1
replace country=2 if CountryCode2==1
replace country=3 if CountryCode3==1
replace country=4 if CountryCode4==1
replace country=5 if CountryCode5==1
replace country=6 if CountryCode6==1
label variable country "Country"
label define COUNTRY 1 "Denmark" 2 "France" 3 "Germany" 4 "Hungary" 5 "Poland" 6 "Spain"
label value country COUNTRY 
fre country

fre zzAge zzGender zzEdu Age
rename Age age
label variable age "Age"
rename zzGender gender
label variable gender "Gender"
rename zzEdu edu
label variable edu "Education"

*** DV: Choice and Rating Tasks
recode cbc_chosen (1=1)(2=0),gen(choice)
label variable choice "Has the vignette been chosen?"
label define CHOICE 0 "No" 1 "Yes"
label value choice CHOICE

recode rating_c1 (1=0)(2=1)(3=2)(4=3)(5=4)(6=5)(7=6)(8=7)(9=8)(10=9)(11=10), gen(rating)
label variable rating "Vignette rating (support for EU policy decision)"
label define RATING 0 "Totally opposed" 1 "-4" 2 "-3" 3 "-2" 4 "-1" 5 "0" 6 "+1" 7 "+2" 8 "+3" 9 "+4" 10 "Totally in favor"
label value rating RATING
fre rating 

*** IV: Dimensions
rename c1a1 bindingness
label variable bindingness "Bindingness of policy decision"
label define BINDINGNESS 1 "Mandatory implementation" 2 "Opt-out possibility" 3 "Voluntary compliance"
label value bindingness BINDINGNESS

rename c1a2 councilvoting 
label variable councilvoting "Majority rule in Council"
label define COUNCILVOTING 1 "Unanimity (national veto)" 2 "Qualified majority" 3 "Simple majority"
label value councilvoting COUNCILVOTING

rename c1a3 participation 
label variable participation "Citizen participation possibilities"
label define PARTICIPATION 1 "Parliamentary elections" 2 "Elections + Consultation" 3 "Elections + Referendum"
label value participation PARTICIPATION

rename c1a4 transparency
label variable transparency "Transparency of decision-making"
label define TRANSPARENCY 1 "No public information" 2 "Information public ex post" 3 "Information always public"
label value transparency TRANSPARENCY

rename c1a5 countrybenefit
label variable countrybenefit "Relative benefits for own country"
label define COUNTRYBENEFIT 1 "Less than for others" 2 "Same as for others" 3 "More than for others"
label value countrybenefit COUNTRYBENEFIT

rename c1a6 problemsolving
label variable problemsolving "Problem-solving capacity of policy"
label define PROBLEMSOLVING 1 "Small degree" 2 "Moderate degree" 3 "Large degree"
label value problemsolving PROBLEMSOLVING


*** Policy area
fre Q8x1
rename Q8x1 policy_area

fre policy_area

* BS-1
gen EU_outside = 0
replace EU_outside=1 if policy_area>=1 & policy_area<=6
fre EU_outside
tab EU_outside policy_area

* BS-2
gen policy_group = 5
replace policy_group = 2 if policy_area==4 | policy_area==7 | policy_area==8
replace policy_group = 3 if policy_area==1 | policy_area==5 | policy_area==6
replace policy_group = 4 if policy_area==3
label define POLICY_GROUP 2 "Economy" 3 "Security" 4 "Climate change" 5 "Rest"
label values policy_group POLICY_GROUP
fre policy_group

*** IV: "Control" variables

mvdecode Q3x1 Q3x2 Q4x1_1_Slice Q4x1_2_Slice Q4x1_3_Slice Q4x1_4_Slice Q6x2 Q2x3 Q2x2 Q2x1 ///
	Q1x2_4_Slice Q1x2_5_Slice Q1x2_6_Slice Q1x1_4_Slice Q4x2 Q1x1_5_Slice Q7x1 Q1x1_3_Slice ///
	Q5x1_1_Slice Q5x1_2_Slice Q5x1_3_Slice Q5x1_4_Slice Q5x1_5_Slice Q5x1_6_Slice ///
	Q4x3_1_Slice Q4x3_2_Slice Q4x3_3_Slice Q4x3_4_Slice Q4x3_5_Slice Q10x1 Q10x3 q10x4 ///
	, mv(99)


* Government support
fre Q1x1_3_Slice
rename Q1x1_3_Slice gov_support
label variable gov_support "Government support"

* Satisfaction with EU democracy
fre Q1x1_5_Slice
rename Q1x1_5_Slice EU_swd

* EU differential
fre Q1x1_4_Slice 
rename  Q1x1_4_Slice nat_swd
gen EU_differential = EU_swd-nat_swd
fre EU_differential

* EU institutional trust
fre Q1x2_4_Slice Q1x2_5_Slice Q1x2_6_Slice
rename Q1x2_4_Slice trust_ecom 
rename Q1x2_5_Slice trust_ep
rename Q1x2_6_Slice trust_ecj
gen EU_instrust=(trust_ecom+trust_ep+trust_ecj)/3
fre EU_instrust

* EU membership support
fre Q2x1
rename Q2x1 EU_member

* EU referendum behavioral intent 
fre Q2x2 
rename Q2x2 EU_referendum 

* EU integration preference
fre Q2x3
gen EU_integration = Q2x3

* EU knowledge
fre Q7x2_1_Slice Q7x2_2_Slice Q7x2_3_Slice
recode Q7x2_1_Slice (1=1)(2=0)(99=0), gen(know1)
recode Q7x2_2_Slice (1=1)(2=0)(99=0), gen(know2)
recode Q7x2_3_Slice (1=1)(2=0)(99=0), gen(know3)
gen EU_knowledge = know1+know2+know3
fre EU_knowledge

* Political interest
fre Q7x1
rename Q7x1 pol_interest

* Left-right ideology
fre Q6x2
rename Q6x2 leftright

* Relative personal benefit
fre Q3x1
rename Q3x1 EU_pers_benefit

* Relative country benefit
fre Q3x2
rename Q3x2 EU_coun_benefit

* Identity 
fre Q4x1_1_Slice Q4x1_2_Slice Q4x1_3_Slice Q4x1_4_Slice
rename (Q4x1_1_Slice Q4x1_2_Slice Q4x1_3_Slice Q4x1_4_Slice) ///
	(id_region id_country id_europe id_world)
fre id_region id_country id_europe id_world

* Cosmopolitan Identity
fre Q4x2
rename Q4x2 cosmopolit
fre cosmopolit

label variable cosmopolit "Cosmopolitan Identity"
label define cosmopolit 1 "Very low" 6 "Very high"
label values cosmopolit cosmopolit

* Anywheres vs. Somewheres
gen anywheres = 0
replace anywheres = 1 if cosmopolit==5 | cosmopolit==6

gen somewheres = 0
replace somewheres = 1 if cosmopolit==1 | cosmopolit==2


* Populism
fre Q5x1_1_Slice Q5x1_2_Slice Q5x1_3_Slice Q5x1_4_Slice Q5x1_5_Slice Q5x1_6_Slice
rename (Q5x1_1_Slice Q5x1_3_Slice Q5x1_5_Slice) (pop1 pop3 pop5)
gen pop2 = (Q5x1_2_Slice*-1)+7
gen pop4 = (Q5x1_4_Slice*-1)+7
gen pop6 = (Q5x1_6_Slice*-1)+7
fre pop1 pop2 pop3 pop4 pop5 pop6
corr pop1 pop2 pop3 pop4 pop5 pop6
gen populist = (pop1+pop2+pop3+pop4+pop5+pop6)/6
fre populist
*hist populist

* Globalization threat
gen glob_threat = (Q4x3_1_Slice + Q4x3_2_Slice + Q4x3_3_Slice + Q4x3_4_Slice + Q4x3_5_Slice)/5
fre glob_threat

* Corona crisis impact
fre Q10x3
rename Q10x3 covid_impact

* Perceived social class
fre q10x4
rename q10x4 social_class


exit

***** ANALYSIS *****

* Table 2 (Descriptives)
fre cosmopolit gov_support age edu gender
tab edu, gen(edu_)
tab gender, gen(gender_)
summarize cosmopolit gov_support age edu_1 edu_2 edu_3 gender_1 gender_2 gender_3
tabstat cosmopolit gov_support age edu_1 edu_2 edu_3 gender_1 gender_2 gender_3, stat(mean median sd min max n) 

* 5 Regression models

* AV: Rating, ML model (vignette and respondent variables)
eststo rating0: mixed rating ///
cosmopolit gov_support age i.edu i.gender i.country || respondent:

* AV: Rating, ML model (vignette and respondent variables)
eststo rating2: mixed rating ib2.bindingness ib2.councilvoting ib2.participation ib2.transparency ib2.countrybenefit ib2.problemsolving ///
cosmopolit gov_support age i.edu i.gender i.country || respondent:

* AV: Rating, ML model (vignette and respondent variables + interactions)
eststo rating3: mixed rating ib2.bindingness ib2.councilvoting ib2.participation ib2.transparency ib2.countrybenefit ib2.problemsolving ///
cosmopolit gov_support age i.edu i.gender i.country c.cosmopolit##ib2.bindingness c.cosmopolit##ib2.councilvoting c.cosmopolit##ib2.participation /// 
c.cosmopolit##ib2.transparency c.cosmopolit##ib2.countrybenefit c.cosmopolit##ib2.problemsolving || respondent:

* Table 3 (see paper)
esttab rating0 rating2 rating3 using io_paper.rtf ///
	, b(2) se(2) pr(2) label noconstant obslast noomitted nobaselevels replace ///
	mtitles("Individual-level model" "Individual+vignette-level model" "Cross-level interaction model")

	
* AV: Rating, ML model (vignette and respondent variables + interactions)
eststo rating3: mixed rating ib2.bindingness ib2.councilvoting ib2.participation ib2.transparency ib2.countrybenefit ib2.problemsolving ///
cosmopolit gov_support age i.edu i.gender i.country c.cosmopolit##ib2.bindingness c.cosmopolit##ib2.councilvoting c.cosmopolit##ib2.participation /// 
c.cosmopolit##ib2.transparency c.cosmopolit##ib2.countrybenefit c.cosmopolit##ib2.problemsolving || respondent:

	
* Figures 1 & 2: Adjusted predictions (interaction effects)
margins, at(cosmopolit=(1(1)6) bindingness=(1(1)3))
marginsplot, title("Bindingness of decisions",size(med) margin(small)) name(bindingness,replace) ///
	ytitle("Predicted acceptance of IO decision")  xtitle("Cosmopolitan Identity") ///
	xlabel(1 `" "Very" "low" "' 2 3 4 5 6 `"  "Very" "high" "') legend(pos(6)row(1)region(lcolor(black)))
	
margins, at(cosmopolit=(1(1)6) councilvoting=(1(1)3))
marginsplot, title("Voting rule in Council",size(med) margin(small)) name(councilvote,replace) ///
	ytitle("Predicted acceptance of IO decision")  xtitle("Cosmopolitan Identity") ///
	xlabel(1 `" "Very" "low" "' 2 3 4 5 6 `"  "Very" "high" "') legend(pos(6)row(1)region(lcolor(black)))




*** APPENDIX ***

* Table A1: Correlation Matrix: Cosmopolitanism, Identity Nation, Identity Europe, Identity World
correlate cosmopolit id_country id_europe id_world

* Table A2: Mean cosmopolitanism across countries
tabstat cosmopolit, by(country)
tabstat cosmopolit [aweight=weight], by(country)

* Table A3: Logistic Regression Models (Direct Effects, Interaction Effects) with choice variable instead of rating (as dependent variable)
eststo choice1: melogit choice ib2.bindingness ib2.councilvoting ib2.participation ib2.transparency ib2.countrybenefit ib2.problemsolving ///
	cosmopolit || respondent:

eststo choice2: melogit choice ib2.bindingness ib2.councilvoting ib2.participation ib2.transparency ib2.countrybenefit ib2.problemsolving ///
	cosmopolit c.cosmopolit##ib2.bindingness c.cosmopolit##ib2.councilvoting c.cosmopolit##ib2.participation /// 
	c.cosmopolit##ib2.transparency c.cosmopolit##ib2.countrybenefit c.cosmopolit##ib2.problemsolving || respondent:

esttab choice1 choice2 using io_appendix.rtf ///
	, b(2) se(2) pr(2) label noconstant obslast noomitted nobaselevels append ///
	mtitles("Direct effects model" "Interaction effects model")
	

* Figure A1: Distribution of cosmopolitanism
hist cosmopolit, percent discrete
hist cosmopolit, percent discrete by(country)

* Figure A2: Distribution of the DV
hist rating, percent discrete
hist rating, percent discrete by(country)

* Figure A3:
eststo cosmo_low: logit choice ib2.bindingness ib2.councilvoting ib2.participation ib2.transparency ib2.countrybenefit ib2.problemsolving ///
	if cosmopolit == 1 | cosmopolit == 2
	
eststo cosmo_high: logit choice ib2.bindingness ib2.councilvoting ib2.participation ib2.transparency ib2.countrybenefit ib2.problemsolving ///
	if cosmopolit == 5 | cosmopolit == 6

coefplot cosmo_low cosmo_high, level(95) base xline(0) omit ///
	keep(*.bindingness *.councilvoting *.participation *.transparency *.countrybenefit *.problemsolving) title("") ///
	headings(1.bindingness = "{bf:Bindingness of decisions}" 1.councilvoting = "{bf:Voting rule in Council}" ///
	1.participation	= "{bf:Citizen participation possibilities}" 1.transparency = "{bf:Information transparency}" ///
	1.countrybenefit = "{bf:Relative benefit for own country}" 1.problemsolving = "{bf:Problem-solving capacity}" ///
	, nogap labsize(vsmall)) ///
	groups(1.bindingness 3.councilvoting = "{bf:Authority}" 1.participation 3.transparency = "Procedure" ///
	1.countrybenefit 3.problemsolving = "Performance",angle(vertical)) ///
	ylabel(,labsize(vsmall)) cismooth msymbol(circle) xlabel(-0.5(0.25)0.5) xscale(range(-0.5 0.5))


